#ifndef DBCONNECTION_H
#define DBCONNECTION_H

#include <QtSql>

class DBConnection
{
public:
    static DBConnection* Instance();

    bool connect(QString host, QString database, QString user, QString password);
    void disconnect();

    void execQuery(QString query);
    QSqlQueryModel* getModel(QString query);

private:
    DBConnection(){}
    DBConnection(DBConnection const&){} // copy constructor is private
    DBConnection& operator=(DBConnection const&){} // assignment operator is private
    static DBConnection* m_pInstance;

    QSqlDatabase _db;
    QSqlQueryModel *_model;
};

#endif // DBCONNECTION_H
